-- File : local_prediction .cc


bool PREDICTOR :: get_prediction(const branch_record_c* br, const op_state_c* os)
{
	uint PC_10bit;
	uint8_t local_table_entry;
	
	//Storing a local copy of the 10 bits of PC
	PC_10bit = br -> instruction_addr;
	
	//Use the 10 bits of PC to index the local table
	local_table_entry = read_table(Local, PC_10bit);
	
	//L_COUNTER_NOT_TAKEN_STATES represents the number of states out of 8 that are interpreted for not taken
	if(local_table_entry > L_COUNTER_NOT_TAKEN_STATES)
	{	
		prediction = true;
	}	
	else
	{
		prediction = false;
	}
	
	return prediction;
}

void PREDICTOR :: update_local_predictor(const branch_record_c* br, const op_state_c* os, bool actual_taken)
{
	uint8_t old_value = read_table(Local, br -> instruction_addr);
	
	uint8_t new_value = evaluate_updation_value(Local, old_value, actual_taken);
	
	write_table(Local,br -> instruction_addr, new_value);
}







